/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("tb_project_reviewstandar",Enums.ActionPermissionOptions.Search)]
 */
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
using MYData.Core.BaseProvider;
using MYData.Core.Utilities;
using MYData.Core.Utilities.Response;
using MYData.Entity.DomainModels;
using MYData.Entity.DomainModels.ApiEntity;
using MYData.Entity.DomainModels.ApiEntity.Dto;
using MYData.System.IServices;
using MYData.System.Services;


namespace MYData.System.Controllers
{
    public partial class tb_project_reviewstandarController
    {
        private readonly Itb_project_reviewstandarService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public tb_project_reviewstandarController(
            Itb_project_reviewstandarService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        /// <summary>
        /// 评审标准库+查询
        /// 名称模糊查询
        /// </summary>
        /// <returns></returns>
        //异步方法
        [HttpGet, Route("list")]
        [AllowAnonymous]
        public async Task<WebResponseContent> GetReviewstandar(string? standarName = "", string? standardselectionID = "")
        {
            return await _service.GetReviewstandar(standarName, standardselectionID);
        }

        /// <summary>
        /// 标准选项添加
        /// </summary>
        /// <param name="inputdto"></param>
        /// <returns></returns>
        //异步编程技术使你的程序可以在执行一个可能长期运行的任务的同时继续对其他事件做出反应而不必等待任务完成。
        [HttpPost,Route("insert")]
        [AllowAnonymous]
        public IActionResult InsertReviewstandar([FromBody]tb_project_reviewstandarinputDto inputdto)
        {
            return  Json(_service.InsertReviewstandar(inputdto));
        }

        /// <summary>
        /// 删除(逻辑删除)
        /// </summary>
        /// <param name="id"></param>
        /// 异步方法，返回类型为 Task<WebResponseContent>
        /// <returns></returns>
        [HttpPost, Route("delete")]
        [AllowAnonymous]
        public IActionResult DeleteReviewstandar(string id)
        {
            return Json(_service.DeleteReviewstandar(id));
        }

        /// <summary>
        /// 标准选项修改
        /// </summary>
        /// <param name="inputdto"></param>
        /// <returns></returns>
        [HttpPost, Route("UpdateInsertReviewstandar")]
        [AllowAnonymous]
        public IActionResult UpdateInsertReviewstandar([FromBody]tb_project_reviewstandaroutputDto inputdto)
        {
            return Json(_service.UpdateInsertReviewstandar(inputdto));
        }

        /// <summary>
        /// 反填/详情
        /// </summary>
        /// <returns></returns>
        [HttpPost, Route("details")]
        [AllowAnonymous]
        public async Task<object> GetDetailReviewstandar(string id)
        {
            return await _service.GetDetailReviewstandar(id);
        }
    }
}
